package Metodos;
import java.io.*;

public final class DatosFile1 {

    FileReader fr;
    BufferedReader bf;
    String server;
    String bdd;
    String usr;
    String pass;
    String completo;
    public DatosFile1(String nombreArchivo) {
        try{
            fr = new FileReader(nombreArchivo);
            bf = new BufferedReader(fr);
            
        }
        catch(FileNotFoundException e){
            System.out.println(e);
        }
        catch(Exception e){
            System.out.println(e);
        }
        server = "urps.us";
        bdd = "kenin_cable";
        usr = "kenin_zar";
        pass = "mierda22";
        completo = "arvixe.txt";
    }
    
    public String obtenerTodo(){
        return "arvixe.txt";
    }

    public boolean obtenerDatos(){
        try{
            while (bf.readLine() != null){
                String aux = bf.readLine();
                if(aux.contains("server=")){
                    int posig = aux.indexOf("=");
                    server = aux.substring(posig+1);
                }
                else if(aux.contains("basedatos="))
                {
                    int posig = aux.indexOf("=");
                    bdd = aux.substring(posig+1);
                }
                else if(aux.contains("usr="))
                {
                    int posig = aux.indexOf("=");
                    usr = aux.substring(posig+1);
                }
                else if(aux.contains("pass=")){
                    int posig = aux.indexOf("=");

                    pass = aux.substring(posig+1);
                }
            }
            bf.close();
            return true;
        }
        catch (IOException e){
            return false;
        }
    }

    public String getBdd() {
        return bdd;
    }

    public String getPass() {
        return pass;
    }

    public String getServer() {
        return server;
    }

    public String getUsr() {
        return usr;
    }



} //FIN CLASE
